package cn.zhz.gen.core;

import cn.zhz.gen.enums.SwaggerVersion;

/**
 * @author ZHZ
 * @since 2023-01-18
 */
public class FastGlobalConfig {

    /**
     * 作者名称
     */
    private String author;

    /**
     * 模块格式-默认开启
     */
    private boolean enableModule = true;

    /**
     * swagger注解-默认开启
     */
    private boolean enableSwagger = true;

    /**
     * swagger注解-版本
     */
    private String swaggerVersion = SwaggerVersion.V3.getCode();

    /**
     * 自动打开输出目录-默认关闭
     */
    private boolean openDir = false;

    /**
     * 模块名称
     */
    private String moduleName;

    /**
     * 父级包名
     */
    private String packageParent;

    /**
     * 第一步创建（唯一入口）
     *
     * @return
     */
    public static FastGlobalConfig create() {
        return new FastGlobalConfig();
    }

    /**
     * 配置作者名称
     *
     * @param author
     * @return
     */
    public FastGlobalConfig author(String author) {
        this.author = author;
        return this;
    }

    /**
     * 自动打开输出目录-开启
     *
     * @return
     */
    public FastGlobalConfig enableOpenDir() {
        this.openDir = true;
        return this;
    }

    /**
     * 模块格式-禁用
     *
     * @return
     */
    public FastGlobalConfig disableModule() {
        this.enableModule = false;
        return this;
    }

    /**
     * swagger注解-禁用
     *
     * @return
     */
    public FastGlobalConfig disableSwagger() {
        this.enableSwagger = false;
        return this;
    }

    /**
     * swagger注解-版本
     *
     * @return
     */
    public FastGlobalConfig swaggerVersion(SwaggerVersion swaggerVersion) {
        this.swaggerVersion = swaggerVersion.getCode();
        return this;
    }

    /**
     * 配置模块名称
     *
     * @param moduleName
     * @return
     */
    public FastGlobalConfig moduleName(String moduleName) {
        this.moduleName = moduleName;
        return this;
    }

    /**
     * 配置父级包名
     *
     * @param packageParent
     * @return
     */
    public FastGlobalConfig packageParent(String packageParent) {
        this.packageParent = packageParent;
        return this;
    }

    protected String getAuthor() {
        return author;
    }

    protected boolean isEnableModule() {
        return enableModule;
    }

    protected String getModuleName() {
        return moduleName;
    }

    protected String getPackageParent() {
        return packageParent;
    }

    protected boolean isOpenDir() {
        return openDir;
    }

    protected boolean isEnableSwagger() {
        return enableSwagger;
    }

    protected String getSwaggerVersion() {
        return swaggerVersion;
    }
}
